{% extends 'admin/index.html' %}
{% block con-title%}
    <div class="container-fluid am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                <div class="page-header-heading">
                    <span class="am-icon-home page-header-heading-icon">会员列表</span>
            
        </div>
    </div>

{% endblock %}

{% block con-body %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">会员列表</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                </div>
                            </div>
                        </div>
                    </div>
                <form action="" method="get">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                       <div class="am-form-group tpl-table-list-select">
                                
                            </div>
                            </div>
                            <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                                <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                    
                                </div>
                            </div>
                        </form>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                                    
                                    <th>用户名</th>
                                    <th>订单号</th>
                                    <th>地址</th>
                                    <th>总价</th>
                                 
                                    <th>状态</th>
                                    <th>购买时间</th>
                                    <th>操作</th>


                             
                                </tr>
                            </thead>
                            <tbody>

                            {% for v in oinfo %}
                                <tr class="gradeX">
                                    
                                    <td class="am-text-middle">{{ v.orderid.uid.username }}</td>
                                    <td class="am-text-middle">{{ v.orderid.id }}</td>
                                    <td class="am-text-middle">{{ v.orderid.addressid.address }}</td>
                                    <td class="am-text-middle">{{ v.orderid.totalprice }}</td>
                                    <td class="am-text-middle" name="dd">

                                        {% if v.orderid.status == 1 %}

                                            已付款，待发货
                                        {% elif v.orderid.status == 2 %}

                                            已发货,待收货

                                        {% endif %}



                                    </td>
                                 


                                    <td class="am-text-middle">{{ v.orderid.addtime|date:'Y-m-d H:i:s' }}</td>
                                    <td class="w125 center opreat b-t hidden-xs hidden-sm">
                                        <ul>
                                            <li class="more"><a href="#"  class="fahuo" fid = "{{ v.orderid.id }}" >发货</a></li>
                                        </ul>
                                    </td>

                                   
                                </tr>
                            {% endfor %}
                         
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">

                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    // 给发货按钮绑定单击事件
    $('.fahuo').click(function(){
        // 获取id
        var fid = $(this).attr('fid')
        var fh = $(this)
       
        // #发送ajax请求
        $.get('{% url "admin_order_fahuo" %}',{'fid':fid},function(data){

            if(data['code']==0){
                fh.html('已发货，待收货')
                fh.parents().find('td[name=dd]').html('已发货，待收货')
                fh.attr('disabled',true)
                fh.css("pointer-events","none")
            }
            alert(data['msg'])

        })
    })



</script>





{% endblock %}





